package com.five.mobile.controller;

import com.five.core.result.Result;
import com.five.pojo.entity.Banner;
import com.five.service.BannerRpcService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/banner")
public class BannerSController {

    @DubboReference
    private BannerRpcService bannerRpcService;

    @RequestMapping(value = "/list/{position}", method = RequestMethod.GET)
    public Result queryAllByPosition(@PathVariable("position") Integer position){
        List<Banner> banners = bannerRpcService.queryAllByPosition(position);
        return Result.buildSuccess(banners);
    }
}
